home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / shots / ShipBossLaserA.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  1.6 KB  |  69 lines

  1. class classes.shots.ShipBossLaserA
  2. {
  3.    var x;
  4.    var y;
  5.    var id;
  6.    var dir;
  7.    var speed;
  8.    var color;
  9.    var clip;
  10.    var xMov = 0;
  11.    var yMov = 0;
  12.    var Name = "shipBossLaserA";
  13.    var power = 20;
  14.    var yank = false;
  15.    function ShipBossLaserA(px, py, pcolor, pDir, pspeed, pid)
  16.    {
  17.       this.x = px;
  18.       this.y = py;
  19.       this.id = pid;
  20.       this.dir = pDir;
  21.       this.speed = pspeed;
  22.       this.color = pcolor;
  23.       _root.d = _root.d + 1;
  24.       this.clip = _root.attachMovie("shipBossLaserA","shipBossLaserA" + this.id + "Clip",_root.d);
  25.       this.clip._x = this.x;
  26.       this.clip._y = this.y;
  27.       this.clip.id = this.id;
  28.       if(this.dir == "L")
  29.       {
  30.          this.xMov = -1 * this.speed;
  31.          this.yMov = 0;
  32.          this.x += this.speed;
  33.       }
  34.       else
  35.       {
  36.          this.xMov = this.speed;
  37.          this.yMov = 0;
  38.          this.x -= this.speed;
  39.       }
  40.       this.clip.gotoAndStop(this.color);
  41.    }
  42.    function hit()
  43.    {
  44.       this.yank = true;
  45.    }
  46.    function main()
  47.    {
  48.       this.xMov *= 1.02;
  49.       if(this.clip.hitTest(_root[_root.char + "Clip"]))
  50.       {
  51.          _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
  52.          this.yank = true;
  53.       }
  54.       if(this.x > 1050 || this.x < -50 || this.y > 650 || this.y < -50)
  55.       {
  56.          this.yank = true;
  57.       }
  58.       if(this.yank)
  59.       {
  60.          _root.removeEnemyShot("shipBossLaserA" + this.id);
  61.          this.yank = false;
  62.       }
  63.       this.x += this.xMov;
  64.       this.y += this.yMov;
  65.       this.clip._x = this.x;
  66.       this.clip._y = this.y;
  67.    }
  68. }
  69.